﻿using System;
using Microsoft.Practices.Prism.Modularity;
using Microsoft.Practices.Prism.Regions;
using Microsoft.Practices.Unity;
using Data;
using Infrastucture;
using Infrastucture.Factories;
using HubModule.Controllers;
using HubModule.Services;

namespace HubModule
{
    public class HubModule : IModule
    {
        private readonly IRegionManager _regionManager;
        private readonly IUnityContainer _container;

        public HubModule(IRegionManager regionManager, IUnityContainer container)
        {
            _regionManager = regionManager;
            _container = container;
        }

        public void Initialize()
        {
            // register views
            _container.RegisterType<Object, Views.HubView>(typeof(Views.HubView).Name);

            // register controllers
            _container.RegisterInstance<IHubController>(new HubController());

            // register serices
            _container.RegisterInstance<IHubService>(new HubService(_container));
        }
    }
}
